//货柜管理-货柜列表-配置文件
App.util.ns('Client.Goods');
Client.Goods.Conf = {
    columns: [
        {name: '商品名', value: 'name',width: '300px',},
        {name: '进货价', width: '60px',value: 'price_cost'},
        {name: '限价', width: '60px',value: 'fixed_price'},
        {name: '商城价', width: '60px',value: 'price_original'},
        //{name: '走路抵金', width: '65px',value: 'moneylimit'},
        //{name: '活动价', width: '80px',value: 'price_lower'},
        {name: '体验价', width: '60px',value: 'price_lowest'},
        //{name: '体验抵金', width: '65px',value: 'experience_payment'},
        {name: '品牌名', width: '60px',value: function (item) {
            return item.brand ? item.brand.name : '-- --';
        }},
        {name: '型号', width: '60px',value: 'models'},
        {name: '库存', width: '60px',value: 'inventory'},
        {name: '卖出数量', width: '65px',value: 'sell_total'},
        {name: '关键词', width: '100px',value: 'classify'},
        {name: '可否体验', width: '65px',value: function(item){
            switch (item.is_experience+'') {
                case '0':
                    return '可体验';
                case '1':
                    return '不可体验';
            }
        }},
        {name: '是否限购', width: '65px',value: function(item){
            switch (item.buylimit+'') {
                case '0':
                    return '否';
                case '1':
                    return '是';
            }
        }},
        {name: '状态', width: '60px',value: function(item){
            switch (item.status+'') {
                case '0':
                    return '下线';
                case '1':
                    return '在线';
            }
        }},
        {name: '创建日期', width: '80px', value: function(item){
            return App.util.formator.date(item.created_at);
        }}
    ],
    form: [
        {type: 'hidden', name: 'id'},
        {type: 'input', name: 'name', title: '名称', required: true, maxLength: 40, rule: {
            type: 'str',
            range: [1, 40]
        }},
        {type: 'img', name: 'icon', title: '图标',rule: {
            type: 'str',
            range: [0, 255]
        }},
        {type: 'video', name: 'video', title: '介绍视频',rule: {
            type: 'str',
            range: [0, 255]
        }},
        {type: 'input', name: 'price_cost', title: '进货价', rule: {
            type: 'str',
            range: [0, 30]
        }},
        {type: 'input', name: 'fixed_price', title: '限价', rule: {
            type: 'str',
            range: [0, 30]
        }},
        {type: 'input', name: 'price_original', title: '商城价', required: true,
            comment: '请输入带两位小数的数字。如88.00',
            rule: {
                type: 'float',
                range: [1],
                decimal: [2, 2]
        }},
        {type: 'input', name: 'price_lowest', title: '体验价', required: true,
            comment: '请输入带两位小数的数字。如88.00',
            rule: {
                type: 'float',
                range: [1],
                decimal: [2, 2]
        }},
        {type: 'selectLists', name: 'brand_id', title: '品牌',
            data_id: 'id',
            data_name: function(item){
                return item.id+':'+item.name;
            },
            dataTable: {
                baseUrl: '/admin/goods/brand',
                dataUrl: 'lists?status=1',
                data_id: 'id',
                data_name: 'name',
                table: {
                    id: 'id',
                    main: 0,
                    columns: [
                        {name: '品牌名', value: 'name'}
                    ]
                },
                filter: [
                    {type: 'keywords'}
                ],
                height: '720px'
            }
        },
        {type: 'tags', name: 'models', title: '型号', rule: {
            type: 'str',
            range: [0,200]
        }},
        {type: 'input', name: 'inventory', title: '库存',required: true, rule: {
            type: 'num'
        }},
        {type: 'input', name: 'sell_total', title: '卖出数量',required: true, rule: {
            type: 'num'
        }},
        {type: 'checkbox', name: 'types', title: '类型', required: true,
            items: App.models.get('goodstypes'),
            item_key: 'id',
            item_name: 'name',
            rule: {
                type: 'str',
                range: [1, 250]
        }},
        {type: 'tags', name: 'classify', title: '关键词', required: true, maxLength: 40, rule: {
            type: 'str',
            range: [1, 200]
        }},
        {type: 'client-goods-spec-specifications', name: 'spec', title: '规格',
            comment: '例如：颜色  红,黄(必须用英文逗号)',
        },
        {type: 'radio', name: 'is_experience', title: '可否体验', required: true,
            items: [
                ['0', '可体验'],
                ['1', '不可体验']
            ],
            defaults: '0'
        },
        {type: 'radio', name: 'buylimit', title: '是否限购', required: true,
            items: [
                ['0', '否'],
                ['1', '是']
            ],
            defaults: '0'
        },
        {type: 'imgs', name: 'posters', title: '轮播图', rule: {
            type: 'str',
            // range: [0, 1000]
        }},
        {type: 'imgs', name: 'imgs', title: '商品详情图', rule: {
            type: 'str',
            // range: [0, 1000]
        }},
        {type: 'imgs', name: 'imgs_parameter', title: '购物须知图', rule: {
            type: 'str',
            // range: [0, 1000]
        }},
        {type: 'textarea', name: 'discription', title: '商品简介',maxLength: 100, rule: {
            type: 'str',
            range: [0, 100]
        }},
        {type: 'textarea', name: 'introduction', title: '功能介绍',maxLength: 500, rule: {
            type: 'str',
            range: [0, 500]
        }}
    ]
};